package klex.eserver.common;

/**
 * 将输入的字符串转换成Unicode编码
 * @author 朱梓兴
 *
 */
public class ToUnicodeUtil {
	
	 public static void main(String[] args) {
		 //在此输入要转换的字符串	
		 System.out.println(toUnicode("在此输入要转换的字符串"));
	 }
	/**
	 * A methord for Simple Chinese Lanuage to Unicode
	 * @param s Simple Chinese Lanuage
	 * @return s1 Unicode
	 */
	public static String toUnicode(String s) {
	    String s1 = "";
	    for (int i = 0; i < s.length(); i++) {
	        s1 +="\\\\u" +  Integer.toHexString(s.charAt(i) & 0xffff);
	    }
	    return s1;
	  }

	
}
